Skip to content

TST: harmonize testing namespace in TestCase (GH8023) #8923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

dxe4
Copy link
Contributor

@dxe4 dxe4 commented Nov 29, 2014

closes #8023

Merged via ace3c46

if np.array_equal(np_array, assert_equal):
return
raise AssertionError('{0} is not equal to {1}.'.format(np_array, assert_equal))
def assert_numpy_array_equal(self, *args, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just pass the np_array and assert_equal arguments, as this will mask wrong arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorisvandenbossche ok will do, i thought this would be better because when 1 function changes then the other will have to be updated.

@jorisvandenbossche
Copy link
Member

@papaloizouc Are you interested in trying to add the other assert_ functions to the TestCase?

@dxe4
Copy link
Contributor Author

dxe4 commented Nov 29, 2014

@jorisvandenbossche sure will do

@jorisvandenbossche
Copy link
Member

I think we should try to do the adding of the methods a bit more automatically (so also the docstring are kept as the original).

Eg something like setattr(TestCase, 'assert_frame_equal', staticmethod(assert_frame_equal)) adds the method to the class keeping the docstring and signature

@jreback

@jreback
Copy link
Contributor

jreback commented Nov 29, 2014

sure easy enough to inspect the module namespace and auto add the methods to TestCase via a generated wrapper

setattr(_TestCase, name, staticmethod(obj))

patch_test_functions()
TestCase = _TestCase
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this make sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't even need to do this in a function, just put it at the end of the module and directly update TestCase. (pls put a comment before though explaining what this is doing).

@jreback jreback changed the title Fix for issue #8023 TST: harmonize testing namespace in TestCase (GH8023) Nov 29, 2014
@jreback jreback added the Testing pandas testing functions or related to the test suite label Nov 29, 2014
@jreback jreback added this to the 0.15.2 milestone Nov 29, 2014
@dxe4 dxe4 force-pushed the refactor_tests_8023 branch 3 times, most recently from 335df10 to 12d75f3 Compare November 30, 2014 10:51
TST: changed *args, **kwargs to fixed arguments. pandas-dev#8023

TST: Moved rest of the test functions to module level. pandas-dev#8023

TST: patch all module level assert functions to TestCase. pandas-dev#8023

CLN: Cleanup TestCase assert functions pathing pandas-dev#8023
@dxe4 dxe4 force-pushed the refactor_tests_8023 branch from 12d75f3 to 844f7ae Compare November 30, 2014 10:51
@jorisvandenbossche
Copy link
Member

Merged via ace3c46

@jorisvandenbossche
Copy link
Member

@papaloizouc Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

harmonize the testing namespace with tm.TestCase
3 participants